package com.haiya.adapter.twoway;

public class TwoWayAdapter implements TwoWayTarget, TwoWayAdaptee{
    TwoWayAdaptee adaptee;
    TwoWayTarget target;

    public TwoWayAdapter(TwoWayAdaptee adaptee) {
        this.adaptee = adaptee;
    }

    public TwoWayAdapter(TwoWayTarget target) {
        this.target = target;
    }

    @Override
    public void specificRequest() {
        System.out.println("适配到目标Target");
        target.request();
    }

    @Override
    public void request() {
        System.out.println("适配到适配者Adaptee");
        adaptee.specificRequest();
    }
}
